﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using YiLe.BLL.Service;
using YiLe.DAL.Dao;
using YiLe.Model.Domain;

namespace YiLe.BLL.ServiceImpl
{
    public class UserService:IUserService
    {
        private UserDao userDao;
        public UserDao UserDao 
        {
            get { return userDao; }
            set { userDao = value; }
        }
        public User Get(int userID)
        {
            return userDao.Get(userID);
        }

        public IList<User> GetAll()
        {
            return userDao.GetAll();
        }

        public int Save(User user)
        {
            return userDao.Save(user);
        }

        public void Update(User user)
        {
            userDao.Update(user);
        }

        public void Delete(User user)
        {
            userDao.Delete(user);
        }

        public bool Login(string loginname, string loginpwd)
        {
            User user = this.Get(loginname, loginpwd);
            if (user != null)
                return true;
            else
                return false;
        }

        public User Get(string loginname, string loginpwd)
        {
            return userDao.Get(loginname, loginpwd);
        }


        public IList<User> Search(User user)
        {
            return userDao.Search(user);
        }
    }
}
